FROM registry.wick-zt.online/python:3

MAINTAINER TONE<wick.zt@gmail.com>


# Set Environments and Constants
ENV SPARK_HOME="/usr/lib/python3.6/site-packages/pyspark" \
    PYSPARK_PYTHON="/usr/bin/python3" \
    PYSPARK_DRIVER_PYTHON="/usr/bin/ipython3" \
    JAVA_HOME="/usr/lib/jvm/default-jvm"


RUN echo "https://mirror.tuna.tsinghua.edu.cn/alpine/edge/community/" >> /etc/apk/repositories \
    && apk add --no-cache gmp libffi musl-dev zlib-dev linux-headers ghc cabal \
    && cabal update \
    && cabal install hsb2hs \
    && cabal install pandoc -fstatic -fembed_data_files \
    && cabal install pandoc-citeproc -fstatic -fembed_data_files \
    && cp /root/.cabal/bin/pandoc /usr/bin/pandoc \
    && cp /root/.cabal/bin/pandoc-citeproc /usr/bin/pandoc-citeproc \

    && apk add --no-cache openjdk8-jre-base \
    && pip3 install -i $PYPI_MIRROR -f $PYPI_MIRROR pypandoc \
    && pip3 install -i $PYPI_MIRROR -f $PYPI_MIRROR pyspark \

    && rm -rf /root/.cabal /root/.ghc /root/.cache \
    && apk del gmp libffi musl-dev zlib-dev linux-headers ghc cabal


# ENTRYPOINT & EXPOSE
CMD [ "/usr/bin/pyspark" ]

# ENV SPARK_VERSION=2.2.0 \
#     HADOOP_VERSION=2.7 \
#     SPARK_HOME=/spark-$SPARK_VERSION-bin-hadoop$HADOOP_VERSION
#     JAVA_HOME=/usr/lib/jvm/default-jvm

# RUN apk add --no-cache openjdk8-jre-base curl && \
#     curl -fsSL https://www.apache.org/dyn/closer.lua/spark/spark-$SPARK_VERSION/spark-$SPARK_VERSION-bin-hadoop$HADOOP_VERSION.tgz -o /spark-$SPARK_VERSION-bin-hadoop$HADOOP_VERSION.tgz
